<!--
 * @Author: 高瑞寒 15932717091@163.com
 * @Date: 2022-04-23 22:50:57
 * @LastEditTime: 2022-04-24 23:38:07
 * @LastEditors: 高瑞寒 15932717091@163.com
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>React</title>
</head>
<body>
  <div id="test"></div>
  <script type="text/javascript" src="../js/react.development.js"></script>
  <script type="text/javascript" src="../js/react-dom.development.js"></script>
  <script type="text/javascript" src="../js/babel.min.js">
  </script>
  <script src="../js/prop-types.js"></script>
  <script type="text/babel">
    function Person(props) {
      const { name, sex, age } = props
      return (
        <ul>
          <li>姓名:{name}</li>
          <li>性别:{sex}</li>
          <li>年龄:{age}</li>
        </ul>
      )
    }
    Person.propTypes = {
      name: PropTypes.string.isRequired,
      sex: PropTypes.string.isRequired,
      age: PropTypes.number
    }
    Person.defaultProps = {
      age: 18
    }

    const p1 = { name: '张三', sex: '男' }
    const p2 = { name: '李四', sex: '男', age: 12 }
    const p3 = { name: '王五', sex: '女', age: 20 }

    ReactDOM.render(<div>
      <Person {...p1} />
      <Person {...p2} />
      <Person {...p3} />

    </div>, document.querySelector('#test'))
  </script>
</body>

</html>